from utils.llm_client import llm_chat

class Translator:
    def __init__(self):
        self.translator_prompt_template = (
            "请你判断原始需求是中文还是英文，如果是英文则原样输出不加任何改动，如果是中文则翻译为英文之后直接输出\n\n"
            "原始需求：{original_requirement}\n"
            "输出："
        )
    
    def translate(self, original_requirement):
        prompt = self.translator_prompt_template.format(
            original_requirement=original_requirement
        )
        response = llm_chat(messages=[{"role": "user", "content": prompt}],model_name="GLM_4_PLUS",temperature=0,max_tokens=100)
        return response.choices[0].message.content

def llm_translate_query(user_requirement):
    translator = Translator()
    content = translator.translate(user_requirement)
    return content 


if __name__ == "__main__":
    user_requirement = "多模态大语言模型的研究现状是什么？"
    translator = Translator()
    content = translator.translate(user_requirement)
    print(content)
        
